//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteJobPosition {
        private readonly IJobPositionRepository _JobPositionRepository;

        public DeleteJobPosition(IJobPositionRepository JobPositionRepository) {
            _JobPositionRepository = JobPositionRepository;
        }

        public virtual void Execute(Guid jobPositionId) {
            var JobPositionToDelete = _JobPositionRepository.GetJobPosition(jobPositionId);

            if (JobPositionToDelete != null) {
                _JobPositionRepository.Delete(jobPositionId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
